<template>
  <el-row :gutter="0">
    <el-col :span="24" :offset="0" style="background: #f5f5f5; padding: 50px">
      <div class="cart-empty-wrapper">
        <div class="cart-empty-content">
          <img
            class="cart-image"
            src="https://cdn.cnbj1.fds.api.mi-img.com/staticsfile/cart/cart-empty.png"
            alt="cart-empty"
          />
          <div class="cart-empty-item">
            <div class="cart-empty-title"> 您的购物车还是空的！ </div>
            <div class="cart-empty-desc">登录后将显示您之前加入的商品</div>
            <div class="cart-empty-btn">
              <el-button
                type="primary"
                class="to-login-btn"
                @click="toOtherPage('auth')"
                >立即登录</el-button
              >
              <el-button
                type="primary"
                class="go-shopping-btn"
                @click="toOtherPage('shop')"
              >
                马上去购物
              </el-button>
            </div>
          </div>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script setup lang="ts">
  import { useRouter } from "vue-router";
  const router = useRouter();

  const toOtherPage = (type: "auth" | "shop") => {
    if (type === "auth") {
      router.push("/auth?type=login");
      return;
    }
    router.push("/shop");
  };
</script>

<style lang="scss" scoped>
  @use "@/styles/variable.scss" as *;

  .cart-empty-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    background: $bsWhite;
    margin: 0 auto;
    max-width: 1200px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  }

  .cart-empty-content {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 24px;
    padding: 40px 0;
  }

  .cart-image {
    width: auto;
    height: 240px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    &:hover {
      transform: scale(1.05);
      filter: brightness(1.05);
    }
  }

  .cart-empty-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    color: #b0b0b0;
  }

  .cart-empty-title {
    font: $bsFont;
    font-size: 36px;
    font-weight: 400;
  }

  .cart-empty-description {
    font-size: 40px;
  }

  .cart-empty-btn {
    margin-top: 20px;
    height: 40px;
    font-size: 12px;
    font: $bsFont;
  }

  .to-login-btn {
    font-weight: 400;
    padding: 25px;
    background: $themeColor;
    border-color: $themeColor;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    &:hover {
      background: $themeColor;
      border-color: $themeColor;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(255, 103, 0, 0.2);
    }

    &:active {
      transform: translateY(0);
      box-shadow: none;
    }
  }

  .go-shopping-btn {
    font-weight: 400;
    padding: 25px;
    background: $bsWhite;
    color: $themeColor;
    border-color: $themeColor;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    &:hover {
      background: $bsWhite;
      border-color: $themeColor;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(255, 103, 0, 0.2);
    }

    &:active {
      transform: translateY(0);
      box-shadow: none;
    }
  }

  :deep(.el-button) {
    width: 150px !important;
    border-radius: 0px !important;
  }
</style>
